﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 一对多
{
    internal class ArticleConfig : IEntityTypeConfiguration<Article>
    {
        void IEntityTypeConfiguration<Article>.Configure(EntityTypeBuilder<Article> builder)
        {
            builder.ToTable("T_Articles");
            builder.Property(a => a.Content).IsRequired().IsUnicode();
            builder.Property(a => a.Title).IsRequired().IsUnicode().HasMaxLength(255);
            //全局查询筛选器
            builder.HasQueryFilter(b => b.IsDeleted == false);
        }
    }
}
